package com.suep.data_analysis.repository;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suep.data_analysis.model.AgentSkills;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AgentSkillsRepository extends BaseMapper<AgentSkills> {

    /**
     * 根据技能ID查询技能
     */
    @Select("SELECT * FROM t_agent_skills WHERE skill_id = #{skillId}")
    @Results({
            @Result(property = "skillId", column = "skill_id"),
            @Result(property = "agentId", column = "agent_id"),
            @Result(property = "skillType", column = "skill_type"),
            @Result(property = "skillMechanism", column = "skill_mechanism"),
            @Result(property = "damageMultiplier", column = "damage_multiplier"),
            @Result(property = "imbalanceMultiplier", column = "imbalance_multiplier"),
            @Result(property = "energyConsumption", column = "energy_consumption")
    })
    AgentSkills findBySkillId(String skillId);

    /**
     * 根据条件查询代理人技能列表
     */
    @Select("SELECT * FROM t_agent_skills WHERE ${ew.SQLSegment}")
    @Results({
            @Result(property = "skillId", column = "skill_id"),
            @Result(property = "agentId", column = "agent_id"),
            @Result(property = "skillType", column = "skill_type"),
            @Result(property = "skillMechanism", column = "skill_mechanism"),
            @Result(property = "damageMultiplier", column = "damage_multiplier"),
            @Result(property = "imbalanceMultiplier", column = "imbalance_multiplier"),
            @Result(property = "energyConsumption", column = "energy_consumption")
    })
    List<AgentSkills> selectAgentSkills(@Param("ew") Wrapper<AgentSkills> queryWrapper);

    /**
     * 根据代理人ID查询所有技能
     */
    @Select("SELECT * FROM t_agent_skills WHERE agent_id = #{agentId}")
    @Results({
            @Result(property = "skillId", column = "skill_id"),
            @Result(property = "agentId", column = "agent_id"),
            @Result(property = "skillType", column = "skill_type"),
            @Result(property = "skillMechanism", column = "skill_mechanism"),
            @Result(property = "damageMultiplier", column = "damage_multiplier"),
            @Result(property = "imbalanceMultiplier", column = "imbalance_multiplier"),
            @Result(property = "energyConsumption", column = "energy_consumption")
    })
    List<AgentSkills> selectAllByAgentId(String agentId);
}